n = int(input())
matrix = []
for _ in range(n):
    row = list(map(int, input().split()))
    matrix.append(row)
is_upper = True
for i in range(n):
    for j in range(i):
        if matrix[i][j] != 0:
            is_upper = False
            break
    if not is_upper:
        break
print("YES" if is_upper else "NO")